package com.aspose.cells.b.a;

public final class zk implements Comparable<Object> {
   public static final zk a = new zk(0L);
   public static final zk b = new zk(Long.MAX_VALUE);
   public static final zk c = new zk(Long.MIN_VALUE);
   private long d;

   public zk(long var1) {
      this.d = var1;
   }

   public zk(int var1, int var2, int var3) {
      this.d = a(var1, var2, var3);
   }

   public long a() {
      return this.d;
   }

   public int b() {
      return (int)(this.d / 864000000000L);
   }

   public double c() {
      return (double)this.d * 1.1574074074074074E-12D;
   }

   public double d() {
      return (double)this.d * 1.6666666666666667E-9D;
   }

   public int compareTo(Object value) {
      if (value == null) {
         return 1;
      } else if (!(value instanceof zk)) {
         throw new IllegalArgumentException("Arg_MustBeTimeSpan");
      } else {
         long var2 = ((zk)value).d;
         if (this.d > var2) {
            return 1;
         } else {
            return this.d < var2 ? -1 : 0;
         }
      }
   }

   public static zk a(double var0) {
      return a(var0, 86400000);
   }

   public int hashCode() {
      return (int)this.d ^ (int)(this.d >> 32);
   }

   public boolean equals(Object value) {
      return value instanceof zk && a(this, (zk)value);
   }

   public static boolean a(zk var0, zk var1) {
      if (var0 == var1) {
         return true;
      } else {
         return var0 != null && var1 != null && var0.d == var1.d;
      }
   }

   private static zk a(double var0, int var2) {
      if (Double.isNaN(var0)) {
         throw new IllegalArgumentException("Arg_CannotBeNaN");
      } else {
         double var3 = var0 * (double)var2;
         double var5 = var3 + (var0 >= 0.0D ? 0.5D : -0.5D);
         if (var5 <= 9.22337203685477E14D && var5 >= -9.22337203685477E14D) {
            return new zk((long)var5 * 10000L);
         } else {
            throw new IllegalStateException("Overflow_TimeSpanTooLong");
         }
      }
   }

   public static zk b(double var0) {
      return a(var0, 60000);
   }

   public static long a(int var0, int var1, int var2) {
      long var3 = (long)var0 * 3600L + (long)var1 * 60L + (long)var2;
      if (var3 <= 922337203685L && var3 >= -922337203685L) {
         return var3 * 10000000L;
      } else {
         throw new IndexOutOfBoundsException("Overflow_TimeSpanTooLong");
      }
   }

   private String a(int var1, int var2) {
      return com.aspose.cells.b.b.zb.a(var1, var2);
   }

   public String toString() {
      StringBuilder var1 = new StringBuilder();
      int var2 = (int)(this.d / 864000000000L);
      long var3 = this.d % 864000000000L;
      if (this.d < 0L) {
         var1.append("-");
         var2 = -var2;
         var3 = -var3;
      }

      if (var2 != 0) {
         var1.append(var2);
         var1.append(".");
      }

      var1.append(this.a((int)(var3 / 36000000000L % 24L), 2));
      var1.append(":");
      var1.append(this.a((int)(var3 / 600000000L % 60L), 2));
      var1.append(":");
      var1.append(this.a((int)(var3 / 10000000L % 60L), 2));
      int var5 = (int)(var3 % 10000000L);
      if (var5 != 0) {
         var1.append(".");
         var1.append(this.a(var5, 7));
      }

      return var1.toString();
   }
}
